<div id=campaign_list>
<table width="100%" style="border-left: 1px dashed grey;background-color: lightyellow;">
<TR class="header">
	<TH>Campaign ID</TH>
	<TH width="35%">Title of Newsletter</TH>
	<TH>Sender Name</TH>
	<TH>Sender Email</TH>
	<TH>Action</TH>
</TR>

<TMPL_LOOP name=CAMPAIGNS>
<TR>
	<TD><TMPL_VAR name=campaign_id><br><span style="font-size:10px;color:grey;"><TMPL_VAR name=campaign_date></TD>
	<TD>
	<TMPL_VAR name=title><br>
	<span class="smalltext">
	<a onClick="window.open('ContentViewer?content_id=<TMPL_VAR name=content_id>', '', 'width=700px,height=600px,resizable=true');">preview</a> | 
	<a onClick="window.open('editor.cgi?content_id=<TMPL_VAR name=content_id>', '', 'width=700px,height=600px,resizable=true');">edit content</a>
	</span>
	</TD>
	<TD><TMPL_VAR name=sender_name></TD>
	<TD><TMPL_VAR name=sender_email></TD>
	<TD style="font-size:10px;"><a onClick="EditCampaign(<TMPL_VAR name=campaign_id>, 'show');">edit</a></TD>
</TR>
</TMPL_LOOP>
</table>

<script>

function EditCampaign(campaign_id, action)
{
    if (action == 'show')
    {
        URL = "Campaigns?action=edit&campaign_id=" + campaign_id;
        Modalbox.show(URL, {title:'Edit Campaign', width: 400,});
    }
    else if (action == 'save')
    {
        URL     = "Campaigns";
        PARAMS  = "action=save_edit&sender_name=" + escape($('campaign_sender_name').value) + 
                  "&sender_email=" + $('campaign_sender_email').value + 
                  "&campaign_id=" + campaign_id +
                  "&exit_link=" + $('exit_link').value;

        new Ajax.Updater('campaign_list', URL, {method:'get', parameters:PARAMS});
        Modalbox.hide();
    }
}

</script>
</div>